import { modal } from 'vue-strap'
import { showMsg, getPortfolioList } from '../../vuex/action'

export default {
  name: 'ModalSearchPortfolio',
  components: {
    'vue-modal': modal
  },
  vuex: {
    actions: {
      xGetList: getPortfolioList,
      xShowMsg: showMsg
    }
  },
  data() {
    return {
      show: false,
      form: {
        name: ''
      },
      list: []
    }
  },
  methods: {
    submit() {
      if (!this.form.name.length) {
        return
      }
      this.xGetList({
        name: this.form.name
      })
        .then((res) => {
          this.list = res.data.data.list
        })
        .catch((res) => {
          this.xShowMsg({
            type: 'danger',
            content: res.error_msg
          })
        })
    }
  }
}
